# This class creates a HTML page. 
package CssCreator;
use strict;


# C'tor
# Input: 1) The title of the page
# 		 2) The path to the css file
# For example:  my $htmlCreator = new HTMLCreator("MyPage", "./styles.css");
sub new ( $ )
{
    my $class = shift;
    my $self = {
		_labels => {},
		_colors => [],
	};
    bless $self, $class;
	$self->_init();
    return $self;
}

# initialization
sub _init{
	my ($self) = @_;
	my @colors = (	
		"White","LightCyan", "yellow", "pink", "Aqua", "DarkKhaki", "LawnGreen", "LightSeaGreen", "Thistle", "PeachPuff", "PaleGreen",
		"Wheat", "SkyBlue", "Silver", "Orange", "DarkSeaGreen", "Coral", "AliceBlue", 
		"AntiqueWhite", "Aquamarine", "Azure", "Beige", "Bisque", "BlanchedAlmond", "Blue", "BlueViolet", "Brown", 
		"BurlyWood", "CadetBlue", "Chartreuse", "Chocolate", "CornflowerBlue", "Cornsilk", "Crimson", "Cyan", "DeepPink", 
		"DeepSkyBlue", "DimGray", "DimGrey", "DodgerBlue", "FireBrick", "FloralWhite", "ForestGreen", "Fuchsia", "Gainsboro", 
		"GhostWhite", "Gold", "GoldenRod", "Gray", "Green", "GreenYellow", "HoneyDew", "HotPink", "IndianRed", "Indigo", "Ivory", "Khaki", 
		"Lavender", "LavenderBlush", "LemonChiffon", "LightBlue", "LightCoral", "LightGoldenRodYellow", "LightGray", 
		"LightGrey", "LightGreen", "LightPink", "LightSalmon", "LightSkyBlue", "LightSlateGray", "LightSteelBlue", "LightYellow", 
		"Lime", "LimeGreen", "Linen", "Magenta", "Maroon", "MediumAquaMarine", "MediumBlue", "MediumOrchid", "MediumPurple", "MediumSeaGreen", 
		"MediumSlateBlue", "MediumSpringGreen", "MediumTurquoise", "MediumVioletRed", "MidnightBlue", "MintCream", "MistyRose", "Moccasin", 
		"NavajoWhite", "Navy", "OldLace", "Olive", "OliveDrab", "OrangeRed", "Orchid", "PaleGoldenRod", "PaleTurquoise", 
		"PaleVioletRed", "PapayaWhip", "Peru", "Plum", "PowderBlue", "Purple", "Red", "RosyBrown", "RoyalBlue", "SaddleBrown", 
		"Salmon", "SandyBrown", "SeaGreen", "SeaShell", "Sienna", "SlateBlue", "SlateGray", "SlateGrey", "Snow", "SpringGreen", 
		"SteelBlue", "Tan", "Teal", "Tomato", "Turquoise", "Violet", "WhiteSmoke", "YellowGreen"
	);
	$self->{_colors} = \@colors;
}

#get color for label
sub getColorForLabel{
	my ($self, $label) = @_;
	$label = int($label);
		
	my @colorArray = @{$self->{_colors}};
	
	(($label <= $#colorArray) && ($label >= 0)) || die "Label $label is not in the allowed range (0-$#colorArray).";
	
	my $choosenColor = $colorArray[$label];
	return $choosenColor;
}

1;
